#include <iostream>
#include <cstring>
#include <vector>
#include <map>
#include <string>
#include <set>
#include <algorithm>
#include <cmath>
#define int long long
using namespace std;

int arr[6][6];

int ans = 0;

bool check()
{
    int cnt = 0;
    for(int i = 1; i <= 5; i ++)
    {
        for(int j = 1; j <= 5; j ++)
        {
            if(arr[i][j] == 1) cnt ++;
        }
    }
    if(cnt != 13) return false;
    for(int i = 1; i <= 5; i ++)
    {
        if(arr[i][1] == 1 && arr[i][2] == 1 && arr[i][3] == 1 && arr[i][4] == 1 && arr[i][5] == 1) return false;
        else if(arr[1][i] == 1 && arr[2][i] == 1 && arr[3][i] == 1 && arr[4][i] == 1 && arr[5][i] == 1) return false;
        else if(arr[i][1] == 0 && arr[i][2] == 0 && arr[i][3] == 0 && arr[i][4] == 0 && arr[i][5] == 0) return false;
        else if(arr[1][i] == 0 && arr[2][i] == 0 && arr[3][i] == 0 && arr[4][i] == 0 && arr[5][i] == 0) return false;
    }

    if(arr[1][1] == 1 && arr[2][2] == 1 && arr[3][3] == 1 && arr[4][4] == 1 && arr[5][5] == 1) return false;
    else if(arr[1][5] == 1 && arr[2][4] == 1 && arr[3][3] == 1 && arr[4][2] == 1 && arr[5][1] == 1) return false;
    else if(arr[1][1] == 0 && arr[2][2] == 0 && arr[3][3] == 0 && arr[4][4] == 0 && arr[5][5] == 0) return false;
    else if(arr[1][5] == 0 && arr[2][4] == 0 && arr[3][3] == 0 && arr[4][2] == 0 && arr[5][1] == 0) return false;

    return true;
}

void dfs(int num)
{
    if(num == 26) 
    {
        if(check())
        {
            ans ++;
        }
        return;
    }
    int x = num / 5 + 1;
    if(num % 5 == 0) x --;
    int y = num % 5;
    if(num % 5 == 0) y = 5;
    arr[x][y] = 1;
    dfs(num + 1);
    arr[x][y] = 0;
    dfs(num + 1);
}

void solve()
{  
    dfs(1);
    cout << ans;
} 

signed main()
{
    int t = 1;
    //cin >> t;
    while(t --)
    {
        solve();
    }
}
